package controller.impl;

import ch.qos.logback.classic.Logger;
import controller.Game;
import controller.Result;
import org.slf4j.LoggerFactory;
import java.util.Random;
import java.util.Scanner;

public  class GameImpl implements Game {

   public enum Resultint
    {
        RESULTINT;
        public  void saveresult()
        {
                int gameresult;
        }
    }

    private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(GameImpl.class);

    public static void main(String[] args) throws InterruptedException
    {
        LOGGER.info("hello world");
        LOGGER.debug("debug");
        LOGGER.error("error");
        LOGGER.warn("warn");
    }

   int userScore=0;
   int compScore=0;



    @Override
    public void GameStart() {
        System.out.println("*****程序已启动*****");
        System.out.println("猜拳游戏开始" + "\n" + "请输入数字 1 :剪刀 2 :石头 3 :布");


        for (int i = 1; i <= 5; i++)//使用for循环定义局数
        {
            System.out.println("\n" + "第" + i + "局游戏开始" + "\n");
            Scanner s = new Scanner(System.in);//获取用户键盘输入信息
            int person = s.nextInt();
            int computer = new Random().nextInt(3) + 1;//获取电脑随机数

            switch (person) {
                case 1:
                    System.out.println("你出的是剪刀");
                    break;
                case 2:
                    System.out.println("你出的是石头");
                    break;
                case 3:
                    System.out.println("你出的是布");
                    break;
                default:
                    System.out.println("出错了");
                    break;
            }

            switch (computer) {
                case 1:
                    System.out.println("电脑出的是剪刀");
                    break;
                case 2:
                    System.out.println("电脑出的是石头");
                    break;
                case 3:
                    System.out.println("电脑出的是布");
                    break;
                default:
                    System.out.println("出错了");
                    break;
            }

            Result Score = new ResultImpl();
            int score = person - computer;
            switch (score) {
                case -1:
                case 2:
                    System.out.println("你输了");
                    Score.compScore();

                    break;

                case 0:
                    System.out.println("平局");
                    Score.equalScore();
                    break;

                case 1:
                case -2:
                    System.out.println("你赢了");
                    Score.userScore();
                    break;

                default:
                    System.out.println("出错了");

                    break;
            }


        }

        Result result = new ResultImpl();
        switch (userScore - compScore) {
            case 0:

                result.equal();
                System.out.println("最终结果是平局了");
                break;

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                result.userwin();
                System.out.println("最终结果是你赢了");
                break;


            case -1:
            case -2:
            case -3:
            case -4:
            case -5:

                result.compwin();
                System.out.println("最终结果是你输了");
                break;

            default:
                System.out.println("出错了");

        }

    }







    @Override
    public void GameRule() {

    }


}



